//
//  BCProjectIntroductionRiskLevelModel.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2018/11/23.
//  Copyright © 2018年 guoshikeji. All rights reserved.
//

#import "BCProjectIntroductionRiskLevelModel.h"

@implementation BCProjectIntroductionRiskLevelModel
- (NSMutableArray<BCProjectIntroductionRiskLevelModel *> *)commonRiskSource {
    if (!_commonRiskSource) {
        _commonRiskSource = [NSMutableArray array];
        [_commonRiskSource addObject:self];
    }
    return _commonRiskSource;
}

+ (NSMutableArray<BCProjectIntroductionRiskLevelModel *> *)displayDataSourceWithOriginalSource:(NSArray<BCProjectIntroductionRiskLevelModel *> *)originalSource {
    
    NSMutableArray *source = [NSMutableArray array];
    //
    NSInteger count = originalSource.count;
    BCProjectIntroductionRiskLevelModel *aboveModel;
    for (int i=0; i<count; i++) {
        BCProjectIntroductionRiskLevelModel *model = originalSource[i];
        if (aboveModel&&(i%4!=0)) {
            if ([aboveModel.risk isEqualToString:model.risk]) {
                [aboveModel.commonRiskSource addObject:model];
                //s结束此次循环
                continue;
            }else {
                [source addObject:model];
            }
        }else {
            [source addObject:model];
        }
        aboveModel = model;
    }
    return source;
}



#pragma mark - testData
+ (NSMutableArray *)testData {
    NSMutableArray *data = [NSMutableArray array];
    //
    BCProjectIntroductionRiskLevelModel *RA = [BCProjectIntroductionRiskLevelModel new];
    RA.risk = @"低风险";
    RA.level = @"RA级";
    RA.levelFull = @"RA级风险";
    RA.levelRule = @"(未筹集满的上轮退回95%)";
    RA.yield = @"48小时收益率1%";
    //
    BCProjectIntroductionRiskLevelModel *RB = [BCProjectIntroductionRiskLevelModel new];
    RB.risk = @"低风险";
    RB.level = @"RB级";
    RB.levelFull = @"RB级风险";
    RB.levelRule = @"(未筹集满的上轮退回90%)";
    RB.yield = @"48小时收益率2%";
    //
    BCProjectIntroductionRiskLevelModel *RC = [BCProjectIntroductionRiskLevelModel new];
    RC.risk = @"低减风险";
    RC.level = @"RC级";
    RC.levelFull = @"RC级风险";
    RC.levelRule = @"(未筹集满的上轮退回85%)";
    RC.yield = @"48小时收益率3%";
    //
    BCProjectIntroductionRiskLevelModel *RD = [BCProjectIntroductionRiskLevelModel new];
    RD.risk = @"中低风险";
    RD.level = @"RD级";
    RD.levelFull = @"RD级风险";
    RD.levelRule = @"(未筹集满的上轮退回80%)";
    RD.yield = @"48小时收益率4%";
    
    //
    [data addObject:RA];
    [data addObject:RB];
    [data addObject:RC];
    [data addObject:RD];
    
    return data;
}

@end
